Here is the code which produces the screen shown above.
I've replaced the "fancy" button with a regular text button, but the problem still persists.
struct NavTestView: View {
@State private var selection: TestView?
var body: some View {
GeometryReader { p in
let plusButton = IconButton(imageName: "plus.circle.fill", color: Color.blue,
imageWidth: p.size.width * 5 / 100, buttonWidth: p.size.width * 5 / 100)
let regularAddButton = Button(action: { log.info("| Regular Add Button pressed") } ) {
plusButton
}
VStack(spacing: 0) {
VStack {
regularAddButton
}.frame(width: p.size.width , height: (p.size.height * 10 / 100) + p.safeAreaInsets.top , alignment: .top)
.background(Color.brown)
.ignoresSafeArea()
NavigationSplitView {
List(names) { n in
NavigationLink {
GeometryReader { inner in
TestView(label: n.name).ignoresSafeArea()
}
} label: {
Button(action: {} ) {
Label(n.name, systemImage: "lasso")
}
}
}.listRowSpacing(p.size.height * 0.15 / 100 )
.toolbar(.hidden, for: .automatic)
} detail: {
TestView(label: "No selection").ignoresSafeArea()//.frame(maxWidth: .infinity , maxHeight: .infinity)
}.frame(width: p.size.width, height: p.size.height * 90 / 100 , alignment: .topLeading)
.background(Color.yellow)
}
}
}
}
struct TestView: View {
var label: String
var body: some View {
GeometryReader { p in
let plusButton = IconButton(imageName: "plus.circle.fill", color: Color(uiColor: ThemeColor.SeaFoam.color),
imageWidth: p.size.width * 5 / 100, buttonWidth: p.size.width * 5 / 100)
let regularAddButton = Button(action: { log.info("| Regular Add Button pressed") } ) {
plusButton
}
VStack {
Button(action: { } ) {
Text("Click me!")
}
// regularAddButton
Text(label)
}.frame(width: p.size.width , height: p.size.height, alignment: .top)
.background(Color.yellow)
}
}
}